<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Attempt Counter</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            text-align: center;
            background-color: #f4f4f9;
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            justify-content: center;
            height: 100vh;
        }

        h1 {
            font-size: 2.5rem;
            margin-bottom: 1rem;
        }

        .count-display {
            font-size: 2rem;
            margin: 1rem 0;
        }

        .instructions {
            font-size: 1rem;
            color: #666;
        }
    </style>
</head>
<body>
<h1>Attempt Counter</h1>
<div class="count-display">0 times</div>
<div class="instructions">Press <strong>Alt + =</strong> to add, <strong>Alt + -</strong> to subtract</div>

<script>
    let count = 0;
    let addTrigger = false;
    let minusTrigger = false;

    const countDisplay = document.querySelector('.count-display');

    // 更新计数显示
    function updateCountDisplay() {
        countDisplay.textContent = `${count} times`;
    }

    // 键盘事件监听
    document.addEventListener('keydown', (event) => {
        if (event.altKey && event.key === '=') {
            // Ctrl + =
            if (!addTrigger) {
                addTrigger = true;
                return;
            }
            count++;
            updateCountDisplay();
            addTrigger = false;
        } else if (event.altKey && event.key === '-') {
            // Ctrl + -
            if (!minusTrigger) {
                minusTrigger = true;
                return;
            }
            if (count > 0) {
                count--;
            }
            updateCountDisplay();
            minusTrigger = false;
        }
    });
</script>
</body>
</html>
